﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PsiIndexer
{
  public static class ConsoleUtils
  {
    public static void ToConsole(this string txt, ConsoleColor color, Boolean newline, params object[] opts)
    {
      ConsoleColor before = Console.ForegroundColor;
      Console.ForegroundColor = color;
      if (newline) {
        Console.WriteLine(txt, opts);
      }
      else {
        Console.Write(string.Format(txt, opts));
      }
      Console.ForegroundColor = before;
    }

    public static void ToConsole(this string txt, params object[] opts)
    {
      txt.ToConsole(Console.ForegroundColor, false, opts);
    }

    public static void ToConsoleNewLine(this string txt, params object[] opts)
    {
      txt.ToConsole(Console.ForegroundColor, true, opts);
    }

    public static void ToConsole(this string txt, ConsoleColor color, params object[] opts)
    {
      txt.ToConsole(color, false, opts);
    }

    public static void ToConsoleNewLine(this string txt, ConsoleColor color, params string[] opts)
    {
      txt.ToConsole(color, true, opts);
    }
  }
}